<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		/* 1. 伸缩布局 flex */  
		* {
			margin: 0;
		}
		html,body {
			height: 100%;
		}
		/* 为父容器设置为伸缩盒子 并将主轴设置为垂直方向 */
		section {
			display: flex;
			flex-direction: column;
			height: 100%;
		}
		header {
			height: 46px;
			background-color: #ccc;
		}
		footer {
			height: 50px;
			background-color: #f40;
		}
		main {
			/* 分配剩余空间 */
			flex: 1;
			background-color: blue;
		}
	</style>
</head>
<body>
	<section>
		<header>头部</header>
		<main>主体</main>
		<footer>底部</footer>
	</section>
</body>
</html>